package data;

import gui.SeatState;

import java.io.Serializable;

import model.ChosenAction;

public class Seat implements SeatInterface, Serializable
{
	private int gameId;
	
	private int index;
	
	private int bet;
	
	private int stack;
	
	private int handCards;
	
	private String username;
	
	private String position;
	
	private SeatState state;

	private boolean taken;
	
	private boolean won;
	
	private ChosenAction chosenAction;
	
	public Seat()
	{
		
	}

	public void setGameId(int gameId)
	{
		this.gameId = gameId;
	}
	
	public int getGameId()
	{
		return gameId;
	}
	
	public void setIndex(int index)
	{
		this.index = index;
	}
	
	public int getIndex()
	{
		return index;
	}
	
	public void setBet(int bet)
	{
		this.bet = bet;
	}
	
	public int getBet()
	{
		return bet;
	}
	
	public void setStack(int stack)
	{
		this.stack = stack;
	}
	
	public int getStack()
	{
		return stack;
	}
	
	public void setHandCards(int handCards)
	{
		this.handCards = handCards;
	}
	
	public int getHandCards()
	{
		return handCards;
	}
	
	public void setUsername(String username)
	{
		this.username = username;
	}
	
	public String getUsername()
	{
		return username;
	}

	public void setPosition(String position)
	{
		this.position = position;
	}
	
	public String getPosition()
	{
		return position;
	}
	
	public void setState(SeatState state)
	{
		this.state = state;
	}
	
	public SeatState getState()
	{
		return state;
	}
	
	public void setTaken(boolean taken)
	{
		this.taken = taken;
		
		setState(taken ? SeatState.TAKEN : SeatState.FREE);
	}
	
	public boolean isTaken()
	{
		return taken;
	}
	
	public void setWon(boolean won)
	{
		this.won = won;
	}
	
	public boolean hasWon()
	{
		return won;
	}
	
	public void setDefault()
	{
		setState(SeatState.DEFAULT);
	}
	
	public void setChosenAction(ChosenAction chosenAction)
	{
		this.chosenAction = chosenAction;
		
		switch (chosenAction.getAction())
		{
			case CHECK:
			case CALL:
				
				setState(SeatState.CALL);
				
				break;
			
			case RAISE:
				
				setState(SeatState.RAISE);
				
				break;
			
			case FOLD:
				
				setState(SeatState.FOLD);
				
				break;
		}
	}
	
	public ChosenAction getChosenAction()
	{
		return chosenAction;
	}
}
